'''It's a file which used to test some functions.'''
from core.utils import logging
# from core.dataloader import TripletDataloader
# from core.model.tokenizer.tokenizer import WhitespaceTokenizer
# from core.model.embedding.word2vec import GloveWord2Vector
# import pickle
# from core.model.span_level_model import *

def test_dataloader():
    tokenizer = WhitespaceTokenizer()
    embedder = GloveWord2Vector('dataset/cropus/42B_w2v.txt')
    triplet_dataloader = TripletDataloader('dataset/ASTE-Data-V2-EMNLP2020/15res/train_triplets.txt', batch_size=8, tokenizer=tokenizer, embedder=embedder)
    batch_data = triplet_dataloader.next_batch_data()
    print(batch_data)
    # for batch_data in triplet_dataloader:
    #     # print('batch_data:', batch_data)
    #     pass

def test_tokenizer():
    tokenizer = WhitespaceTokenizer()
    text = tokenizer.tokenize('This is test code .')
    print(text)

def test_embedding():
    token = ['This', 'is', 'test', 'code', '.']
    print('read cropus.')
    # embedder = GloveWord2Vector('../dataset/cropus/42B_w2v.txt')
    # with open('glove_model.pkl', 'wb') as f:
    #     pickle.dump(embedder, f)
    with open('glove_model.pkl', 'rb') as f:
        embedder = pickle.load(f)
    embedding = embedder(token)
    print('embedding: ', embedding)

def test_log():
    print('\033[0;31mThis is a red print\033[0m')
    logging.info('\033[0;31mThis is info\033[0m - end')
    logging.warning('this is warning')
    logging.error('this is test error')

def test_model():
    model = SpanLevelModel(300)

# test_tokenizer()
# test_dataloader()
test_log()
# test_model()
